package com.fishery.processing.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.util.Date;
import java.io.Serializable;

import com.fishery.entity.GlobalException;
import com.fishery.entity.StatusCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.StringUtils;

/**
 * <p>
 * 
 * </p>
 *
 * @author run
 * @since 2021-03-12
 */
@TableName("t_processing_job")
@ApiModel(value="TProcessingJob对象", description="加工作业对象")
public class Job implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "加工作业id")
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    @ApiModelProperty(value = "所用原料id")
    private String materialId;

    @ApiModelProperty(value = "所用原料质量 /kg")
    private Double materialWeight;

    @ApiModelProperty(value = "生产产品id")
    private String productId;

    @ApiModelProperty(value = "成品预估质量 /kg")
    private Double productWeight;

    @ApiModelProperty(value = "作业描述")
    private String jobDescription;

    @ApiModelProperty(value = "作业完成时间", hidden = true)
    private Date completeTime;

    @ApiModelProperty(value = "操作员姓名")
    private String operatorName;

    @ApiModelProperty(value = "所属加工厂id")
    private String processingFactoryId;

    @ApiModelProperty(value = "创建时间", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    private Date gmtCreate;

    @ApiModelProperty(value = "修改时间", hidden = true)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    @ApiModelProperty(value = "逻辑删除", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    @TableLogic
    private Integer isDeleted;

    @ApiModelProperty(value = "版本号", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    @Version
    private Integer version;

    public String getProcessingFactoryId() {
        return processingFactoryId;
    }

    public void setProcessingFactoryId(String processingFactoryId) {
        this.processingFactoryId = processingFactoryId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMaterialId() {
        return materialId;
    }

    public void setMaterialId(String materialId) {
        this.materialId = materialId;
    }


    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public Double getMaterialWeight() {
        return materialWeight;
    }

    public void setMaterialWeight(Double materialWeight) {
        this.materialWeight = materialWeight;
    }

    public Double getProductWeight() {
        return productWeight;
    }

    public void setProductWeight(Double productWeight) {
        this.productWeight = productWeight;
    }

    public String getJobDescription() {
        return jobDescription;
    }

    public void setJobDescription(String jobDescription) {
        this.jobDescription = jobDescription;
    }

    public Date getCompleteTime() {
        return completeTime;
    }

    public void setCompleteTime(Date completeTime) {
        this.completeTime = completeTime;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        if (StringUtils.isEmpty(operatorName)){
            throw new GlobalException(StatusCode.ERROR,"操作员姓名不能为空");
        }
        operatorName = operatorName.trim();
        this.operatorName = operatorName;
    }
}
